package com.hnas.trade.web;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.hnas.trade.service.NewCheckOrderTaskService;
import com.hnas.trade.service.UpdateCoreTradeTaskService;

@Controller
@RequestMapping("/test")
public class TestController {

	private ObjectMapper objectMapper = new ObjectMapper();
	
	@Autowired
	private NewCheckOrderTaskService newCheckOrderTaskService;
	@Autowired
	private UpdateCoreTradeTaskService updateCoreTradeTaskService;
	
	/*@RequestMapping(value="/test1",method=RequestMethod.POST)
	public void test1(HttpServletRequest request) throws Exception{
		String swiftNumber = request.getParameter("swiftNumber");
		SearchRecgPayInfoForm form = new SearchRecgPayInfoForm();
		form.setSwiftNumber(swiftNumber);
		CommonReturn searchRecgPayInfo = PostServerInfoGet.searchRecgPayInfo(form);
		if (ResultCode.SUCCESS.equals(searchRecgPayInfo.getResultCode())) {
			SearchRecgPayInfoReceive searchRecgPayInfoReceive = (SearchRecgPayInfoReceive) searchRecgPayInfo
					.getResultData();
			System.out.println(objectMapper.writeValueAsString(searchRecgPayInfoReceive));
		}else{
			System.out.println(searchRecgPayInfo.getResultMsg());
		}
	}*/
	
	@RequestMapping(value="/updateCoreTrade")
	public void test4() throws Exception{
//		newCheckOrderTaskService.checkOrderStatus();
		updateCoreTradeTaskService.doSynCoreMethod();
	}
	
	public static void main(String[] args) {
		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
		try {
			Date parse = sdf.parse("20170828");
			System.out.println(sdf.format(parse));
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
